<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <meta name="renderer" content="webkit">
    <title></title>  
    <link rel="stylesheet" href="__CSS__/pintuer.css">
    <link rel="stylesheet" href="__CSS__/admin.css">
    <script src="__JS__/jquery.js"></script>
    <script src="__JS__/pintuer.js"></script>
</head>
<body>
<form method="get" action="{:url('admin_forum')}">
  <div class="panel admin-panel">
    <div class="panel-head">
        <strong class="icon-reorder">{$info.m_title}-帖子回复管理</strong>
        <a onclick="javascript:history.back()" style="display: inline-block;float: right;"><span class="icon-backward"></span> 返回</a>
    </div>
    <div class="padding border-bottom">
      <ul class="search">
        <li>
          <button type="button"  class="button border-green" id="checkall"><span class="icon-check"></span> 全选</button>
          <a onclick="DelSelect()" class="button border-red"><span class="icon-trash-o"></span> 批量删除</a>
        </li>
      </ul>
    </div>
    <table class="table table-hover text-center">
      <tr>
        <th width="120">回复id</th>
        <th>回复内容</th>
        <th width="240">回复时间</th>
        <th>回复人</th>
        <th>操作</th>
      </tr>
        {volist name='list' id='res'}
        <tr>
          <td><input type="checkbox" name="id[]" value="{$res.r_id}" />
              {$res.r_id}</td>
          <td>{$res.r_content}</td>
          <td>{$res.r_createat}</td>
          <td>{$res.r_unick}</td>
          <td>
            <div class="button-group"><a class="button border-red" href="javascript:void(0)" onclick="return del({$res.r_id})"><span class="icon-trash-o"></span> 删除</a></div>
          </td>
        </tr>
        {/volist}
      {if $page}
      <tr>
        <td colspan="8" class="pagelist">{$page|raw}</td>
      </tr>
      {/if}
    </table>
  </div>
</form>
<script type="text/javascript">

function del(id){
	if(confirm("您确定要删除吗?")){
		$.getJSON('/res/delete', {r_id:id}, function(response) {
            if (response.rs) {
                alert("删除成功!");
                window.location.reload();
            }
        })
	}
}
$("#checkall").click(function(){
  $("input[name='id[]']").each(function() {
      this.checked ? this.checked = false :  this.checked = true;
  });
})

function DelSelect(){
	var Checkbox = false
    var mid = []
	 $("input[name='id[]']").each(function(){
	  if (this.checked==true) {
        mid.push(this.value)
        Checkbox=true;
	  }
	});
	if (Checkbox){
		var t = confirm("您确认要删除选中的内容吗？")
		if (!t) return false
        del(mid)
	} else {
		alert("请选择您要删除的内容!");
		return false;
	}
}
</script>
</body></html>